package com.shujia.day20.lambda9;

import java.util.function.Consumer;

/*
    java内置函数式接口：消费型接口
    只有函数式接口【有且仅有一个抽象方法】才可以被@FunctionalInterface注解所修饰
    @FunctionalInterface
    public interface Consumer<T> {
        void accept(T t);
    }
 */
public class Demo {
    public static void main(String[] args) {
        Staff s = new Staff("sj1001", "李刚", 18, 35000);
        fun1(s, liGang -> System.out.println("员工编号：" + liGang.getId() + ", 姓名：" + liGang.getName() + ", 年龄：" + liGang.getAge() + ", 薪资：" + liGang.getSalary()));
    }

    public static void fun1(Staff staff, Consumer<Staff> consumer) {
        consumer.accept(staff);
    }
}
